import Router from '../../modules/KoaWebSocketRouter';


const prefix = 'dc';
const router = new Router();

router.use('open', function* dispatch() {
    const log = this.app.log.getLogger('WS:[dc:open]');
    const params = this.params;

    const deviceId = params.cid;
    const message = params.message || {};

    log.info('[open] success: deviceId = %s, message = %s', deviceId, message);

    this.send('dc:open', { today: +new Date() }, this.id);
});

export {
    prefix,
    router,
};
